home *** CD-ROM | disk | FTP | other *** search
/ Experimental BBS Explossion 3 / Experimental BBS Explossion III.iso / pascal / xlibpas.zip / UNCHAIN.DOC < prev    next >
Text File  |  1993-06-01  |  10KB  |  290 lines

  1.   ══════════════════════════════════════════════════════════════════════════
  2.  
  3.                      UNCHAIN   Planar VGA Mode 13h Enforcer
  4.                               v2.1  May 1, 1993
  5.  
  6.               Copyright 1993 Colin Buckley.  All Rights Reserved.
  7.  
  8.   Use or distribute freely in any environment. In other words, it's FreeWare
  9.  
  10.   ══════════════════════════════════════════════════════════════════════════
  11.  
  12.  
  13. Introduction
  14. ════════════
  15.  
  16.     Borland development tools will only remember which video mode you are
  17. in, it doesn't save any possible video card register changes you might have
  18. made.
  19.  
  20.     There is a great deal of hype over "Mode X", but if you don't own
  21. a secondary video card (monochrome), it's impossible to debug in a Borland
  22. IDE.
  23.  
  24.     I asked if someone had written a program like this on rec.games.programmer
  25. a Usenet newsgroup, and was ignored.  It surprised me because every 2nd message
  26. is regarding "Mode X".
  27.  
  28.     I wrote UNCHAIN v1.O that only forced 320x200x256x4.  It was the only
  29. mode I used, and no one else seemed interested in it anyways.  I was just
  30. going to keep it for myself, but I thought what the hell and posted the
  31. source in r.g.p.
  32.  
  33.     UNCHAIN v2.O should support all Planar VGA modes in the various resolutions,
  34. but since I only use 320x200, they have not been tested at all.  I've also
  35. added Palette saving and restoring, and viewing of video pages.
  36.  
  37.     It is all completely transparent to the user, only the viewing of video
  38. pages is interactive as it should be.
  39.  
  40.     UNCHAIN can also restore your palette.  Palette restoring works
  41. indepentently of the VGA register savings, so you can use UNCHAIN to restore
  42. the palette in regular Mode 13h aswell.
  43.  
  44.     This is v2.1, the help screen was updated, some minor bugs were fixed,
  45. memory resizing is dynamic, a reset command was added, palette saving/restoring
  46. now affecting colour 255, palette saving/restoring works for regular Mode 13h,
  47. Video page viewing corrected, and the documentation was heavily updated.
  48.  
  49.  
  50. Usage
  51. ═════
  52.  
  53.     UNCHAIN requires <3K of memory.
  54.  
  55.     If you use...
  56.  
  57.       >TD YourGame.EXE <YourGame commandline options>
  58.  
  59.     then use...
  60.  
  61.       >UNCHAIN TD.EXE YourGame.EXE <YourGame commandline options>
  62.  
  63.     Note the addition of the extension for TD.  If TD.EXE is not in the
  64. current directory, you will have to use the entire filename, such as...
  65.  
  66.       >UNCHAIN C:\TD\TD.EXE YourGame.EXE <YourGame commandline options>
  67.  
  68.     UNCHAIN will spawn TD and Turbo Debugger will load your game and operate
  69. as usual.
  70.  
  71.     You must add some assembler instructions in order for this program to
  72. work transparently.  If the instructions are not present, the program
  73. will act like it was not loaded.
  74.  
  75.     If you are unfamiliar with assembler, in Pascal use..
  76.  
  77.     ASM
  78.       Assembler Instructions
  79.     End;
  80.  
  81.     In C use...
  82.  
  83.     asm{
  84.       Assembler Instructions
  85.     }
  86.  
  87.     After you have entered Mode 13h and modified the VGA registers, use the
  88. following code...
  89.  
  90.       MOV  AX,0CB00h
  91.       INT  10h
  92.  
  93.     The above code is the only really necessary instructions.  You do not
  94. have to add the following instructions unless you want the following features
  95. aswell.
  96.  
  97.  
  98.     To reset the VGA registers saved by the above command, use the following
  99. code...
  100.  
  101.       MOV  AX,0CB06h
  102.       INT  10h
  103.  
  104.     The purpose of this command is to allow you to use Mode 13h and unchained
  105. modes together.  Place the above code before you enter Mode 13h, so
  106. UNCHAIN doesn't restore the VGA registers.  If you use multiple resolutions
  107. in your program, then it would be wise to use the above code before you
  108. enter each one, but not necessary.
  109.  
  110.  
  111.     Every time you set the palette use the following code..
  112.  
  113.       MOV  AX,0CB05h
  114.       INT  10h
  115.  
  116.     If you do Screen Fades then they will run at half speed because UNCHAIN
  117. gets the palette everytime, assuming you add the above code to your SetPalette
  118. routine and it is called by your screen fade.  They will work at full speed
  119. when UNCHAIN is not loaded.
  120.  
  121.     I only use one palette per game, so I actually use the above code
  122. as part of the game after I set the palette.  It's not part of the SetPalette
  123. code, so I can avoid the fade slow down problem.
  124.  
  125.     Palette restoring works indepentently of the VGA register savings, so
  126. you can use UNCHAIN to restore the palette in regular Mode 13h aswell.
  127.  
  128.  
  129.     In order to view Video Pages, you must tell UNCHAIN the offsets of upto 4
  130. pages, then while looking at the USER SCREEN (ALT-F5), you may press CTRL-1
  131. for Page 1, CTRL-2 for Page 2, CTRL-3 for Page 3, CTRL-4 for Page 4.
  132.  
  133.     To tell UNCHAIN what offset Page 1 is at use the following code..
  134.  
  135.       MOV  BX,Page1Offset
  136.       MOV  AX,0CB01h
  137.       INT  10h
  138.  
  139.     To tell UNCHAIN what offset Page 2 is at use the following code..
  140.  
  141.       MOV  BX,Page2Offset
  142.       MOV  AX,0CB02h
  143.       INT  10h
  144.  
  145.     To tell UNCHAIN what offset Page 3 is at use the following code..
  146.  
  147.       MOV  BX,Page3Offset
  148.       MOV  AX,0CB03h
  149.       INT  10h
  150.  
  151.     To tell UNCHAIN what offset Page 4 is at use the following code..
  152.  
  153.       MOV  BX,Page4Offset
  154.       MOV  AX,0CB04h
  155.       INT  10h
  156.  
  157.     The following default offsets are set until you change them.
  158.  
  159.     Page 1 defaults to offset 0000          (Page 1 in 320x200)
  160.     Page 2 defaults to offset 16000         (Page 2 in 320x200)
  161.     Page 3 defaults to offset 32000         (Page 3 in 320x200)
  162.     Page 4 defaults to offset 48000         (Page 4 in 320x200)
  163.  
  164.     *********************************************************************
  165.     IMPORTANT: DO NOT PRESS CTRL-x UNLESS YOU ARE VIEWING THE USER SCREEN
  166.     *********************************************************************
  167.  
  168.     If you use a library, it would be best to add the code directly to
  169. the library routines so it's always set up correctly.  If UNCHAIN is not
  170. loaded the added instructions should do absolutely nothing.
  171.  
  172.     **************************************************************************
  173.     NOTE: I HAVE NOT CHECKED THE INTERRUPT LIST IF AH=CB INT 10h DOES ANYTHING
  174.     **************************************************************************
  175.  
  176.  
  177. Applications that Work
  178. ══════════════════════
  179.  
  180.     I have only tested UNCHAIN with the following programs, and it works
  181. perfectly.  There is no screen corruption at all.
  182.  
  183.     Turbo Debugger v3.2:       Graphics Save = On
  184.                                Display Method = Swap Pages
  185.  
  186.     Turbo Profiler v2.2:       Graphics Save = On
  187.                                Display Method = Swap Pages
  188.  
  189.     Turbo Pascal v6:           Graphics Save = On
  190.  
  191.     Borland Pascal v7:         Graphics Save = On
  192.  
  193.     For TD and TPROF it would be wise to save your setup as the default config
  194. file, rather then updating an EXE, so that all the TD and TPROF incarnations
  195. will be setup correctly.
  196.  
  197.     Please report all applications that work with UNCHAIN to me so I can
  198. update this list.  Please include the options necessary for it to work.
  199. My address is at the end of this file.
  200.  
  201.  
  202. Problems
  203. ════════
  204.  
  205. Problem:
  206.  
  207.   UNCHAIN reports "Error: Can not execute file!"
  208.  
  209. Solution:
  210.  
  211.   COMMAND.COM is not executing the file, rather UNCHAIN is spawning it.
  212. Therefore you must specify the extension of the file you wish to execute,
  213. along with the entire path to the file, if it is not in the current directory.
  214.  
  215. For example...
  216.  
  217.     If you use...
  218.  
  219.       >TD YourGame.EXE <YourGame commandline options>
  220.  
  221.     ...and TD.EXE is in your path as being in C:\TD, you will have to use...
  222.  
  223.       >UNCHAIN C:\TD\TD.EXE YourGame.EXE <YourGame commandline options>
  224.  
  225.     ...unless it is in the current directory, in which case...
  226.  
  227.       >UNCHAIN TD.EXE YourGame.EXE <YourGame commandline options>
  228.  
  229.     ...is fine.
  230.  
  231.  
  232. Problem:
  233.  
  234.     UNCHAIN is running but there are 4-16 smaller screens instead of the regular
  235. full screen.
  236.  
  237. Solution:
  238.  
  239.     UNCHAIN can not remove Chain 4 from Mode 13h, because you haven't added the
  240. assembler instructions to your code that UNCHAIN needs to operate transparently.
  241.  
  242.  
  243. Problem:
  244.  
  245.     UNCHAIN is running, I see the regular full screen, but portions of the
  246. screen become corrupt.
  247.  
  248. Solution:
  249.  
  250.     Change the display method the application UNCHAIN is spawning to use Swap
  251. Pages (which saves and restores the text screen to conventional memory, rather
  252. then VGA display memory) and set Graphics Save to On.  The Borland applications
  253. I run have display methods as a configuration option, with the exception
  254. of Borland Pascal, but it's method is still UNCHAIN friendly.
  255.  
  256.     If you're not using a Borland application, play around with the display
  257. methods, if that is not an option, or you still can't correct the screen,
  258. you'll have to live with it.
  259.  
  260.  
  261. Release History
  262. ═══════════════
  263.  
  264. v1.00  December 26, 1992
  265.  
  266.   o Initial Release
  267.  
  268.  
  269.  
  270. Credits
  271. ═══════
  272.  
  273.     The Planar Mode set routines were influenced by Themie's XLIB,
  274. who based his on Michael Abrash, who got his from public domain code courtesy
  275. of John Bridges.
  276.  
  277.     The Video Page display routine was taken from John Slagel's XBLT as it
  278. used Display Enable.
  279.  
  280.     Everything else was pieced together from various code I had written in
  281. the past.
  282.  
  283.  
  284. Colin Buckley
  285. Toronto, Ontario, Canada.
  286.  
  287. colin.buckley@rose.com (or route me on RIME at Node 1047 in GameDesign)
  288.  
  289.   ══════════════════════════════════════════════════════════════════════════
  290.